package com.yunyi.dm.factory.before;

/**
 * 咖啡店
 *
 * @author yunyi
 */
public class CoffeeStore {
    public Coffee getCoffee(String type) {
        Coffee coffee = null;
        if ("american".equals(type)) {
            coffee = new AmericanCoffee();
        } else if ("latte".equals(type)) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("没有咖啡");
        }
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}
